<script setup>
import { ref, onMounted } from 'vue'
import { useUserStore } from '@/stores'
import { useGetFinishedTasksService } from '@/api/task'

const userStore = useUserStore()
const { userId } = userStore

// 全部任务列表
const finishedTasksList = ref([])
// 获取已完成任务列表
const getFinishedTasks = async () => {
  const res = await useGetFinishedTasksService({ user_id: userId })
  finishedTasksList.value = res.data.data
  console.log('已完成任务列表' + JSON.stringify(finishedTasksList.value))
}
// 页面加载时获取已完成任务列表
onMounted(() => {
  getFinishedTasks()
})
</script>

<template>
  <FinishedTasksContent @refreshTasks="getFinishedTasks" :taskList="finishedTasksList"></FinishedTasksContent>
</template>

<style lang="less" scoped>

</style>
